package com.eu.ebpm.engine.pvm;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.eu.ebpm.engine.cmd.pvm.UserTaskFinishCommand;
import com.eu.ebpm.engine.cmd.pvm.UserTaskIntoCommand;
import com.eu.ebpm.engine.entity.deploy.Mission;
import com.eu.ebpm.engine.entity.deploy.Transfer;
import com.eu.ebpm.engine.entity.runtime.TaskEntity;

/**
 * 
 * @author 王晓华
 */
@Component
public class UserTaskService extends PvmEngine implements EngineService {
	
	@Autowired
	private UserTaskIntoCommand userTaskIntoCommand;
	
	@Autowired
	private UserTaskFinishCommand userTaskFinishCommand;
	
	public void into(Mission mission, TaskEntity task, Map<String, Object> variables) {
		userTaskIntoCommand.execute(mission, task, variables);
	}
	
	public void commit(Mission mission, TaskEntity task, Map<String, Object> vs) {
		
		Transfer nextTransfer = matchedNextTransfer(mission.getTransfers(), vs);
		
		userTaskFinishCommand.execute(mission, task, vs, nextTransfer);
		
		doDispatch(task, mission.getTransfers(), vs);
		
	}

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	
	
}
